import { downloadOneFile, downloadMultiFile } from '@/api/file';

const actions = {
  downloadOneFile({ commit }, param) {
    return new Promise((resolve, reject) => {
      downloadOneFile(param)
        .then(res => {
          const { data } = res;
          if (data) {
            console.log(data);
          }
          resolve(data);
        })
        .catch(err => {
          reject(err);
        });
    });
  },
  downloadMultiFile({ commit }, param) {
    return new Promise((resolve, reject) => {
      downloadMultiFile(param)
        .then(res => {
          const { data } = res;
          if (data) {
            console.log(data);
          }
          resolve(data);
        })
        .catch(err => {
          reject(err);
        });
    });
  }
};

export default {
  namespaced: true,
  actions
};
